package com.lane.sidecn.product.model;

import java.util.Set;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.compass.annotations.Searchable;
import org.compass.annotations.SearchableProperty;


/**
 * 产品分类目录.带jpa 与 compass的 annotation配置.
 *
 * @author 黄连忠
 */
@Entity

@Table(name="CATEGORY")
@Searchable(root = false, alias = "category")
public class Category {
	private Integer id;

	private Set<Product> products;

	/**
	 * 分类名称
	 */
	@SearchableProperty(name = "catname")
	private String name;

	/**
	 * 类型描述
	 */
	@SearchableProperty(name = "catdescn")
	private String descn;

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getDescn() {
		return this.descn;
	}

	public void setDescn(String descn) {
		this.descn = descn;
	}

	@Transient
	public Set<Product> getProducts() {
		return this.products;
	}

	public void setProducts(Set<Product> products) {
		this.products = products;
	}
}
